package com.jeesite.modules.storage.api;


/**
 * 活动关注Controller
 */

import com.jeesite.modules.storage.service.BrandFocusService;
import com.jeesite.modules.storage.common.ServerResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController(value = "apibrandfocus")
@RequestMapping(value = "/api/brand/focus")
public class BrandFocusController extends APIController {

    @Autowired
    private BrandFocusService brandFocusService;

    /**
     * 加入关注
     * @param transMemberId 转发会员Id
     * @param memberId 会员Id
     * @param brandId 品牌Id
     * @return 分享
     */
    @RequestMapping(method = RequestMethod.POST,value = "join")
    @ResponseBody
    public ServerResponse<Map> join(@RequestParam(value = "transMemberId",required = false)String transMemberId,@RequestParam(value = "memberId")String memberId, @RequestParam(value = "brandId") String brandId){
        return ServerResponse.createBySuccess(200,brandFocusService.join(transMemberId, memberId,brandId));
    }

    /**
     * 取消关注
     * @param transMemberId 转发会员Id
     * @param memberId 会员Id
     * @param brandId 品牌Id
     * @return 分享
     */
    @RequestMapping(method = RequestMethod.POST,value = "cancel")
    @ResponseBody
    public ServerResponse<Map> cancel(@RequestParam(value = "transMemberId",required = false)String transMemberId,@RequestParam(value = "memberId")String memberId, @RequestParam(value = "brandId") String brandId){
        return ServerResponse.createBySuccess(200,brandFocusService.cancel(transMemberId, memberId,brandId));
    }

    /**
     * 查询关注品牌列表
     * @param transMemberId 转发会员Id
     * @param memberId 会员Id
     * @param identity 标识【Hot热播 End已结束】
     * @param size 每页数量
     * @param page 页码
     * @return 关注品牌列表
     */
    @RequestMapping(method = RequestMethod.GET,value = "query")
    @ResponseBody
    public ServerResponse<List<Map>> query(@RequestParam(value = "transMemberId",required = false)String transMemberId,@RequestParam(value = "memberId")String memberId, @RequestParam(value = "identity")String identity, @RequestParam(value="size",defaultValue = "10") Integer size, @RequestParam(value="page",defaultValue = "1") Integer page){
        return ServerResponse.createBySuccess(200,brandFocusService.getBrandList(transMemberId,memberId,identity,size,page));
    }
}
